package com.zhanglei.method;

/**
 * @author caesar
 * @date 2025/7/5
 * @apiNote
 */
public class Rectangle {
    public int length;
    public int width;

    public Rectangle() {
    }

    public Rectangle(int length, int width) {
        if(length <= 0 || width <= 0 ){
            System.out.println(length+"，" +width +"无法构成矩形！");
        }else{
            this.length = length;
            this.width = width;
        }
    }

    public int getArea(){
        return length * width;
    }

    public int getPerimeter(){
            return (length + width) * 2;
    }

}
